// 1987 Recoding

global keepers1987 ""

numlabel, add

genl id=serialno
global keepers1987 $keepers1987 id

genl year=1987
global keepers1987 $keepers1987 year

genl wt=weight
global keepers1987 $keepers1987 wt

genl income=v64
recode income 95/99=.
genl income3=income
centile income, c(33 66 100)
replace income3=0 if income<=r(c_1)
centile income, c(33 66 100)
replace income3=1 if income>r(c_1) & income<=r(c_2)
centile income, c(33 66 100)
replace income3=2 if income>r(c_2) & income<=r(c_3)
global keepers1987 $keepers1987 income3

genl pid_ce=v12a
recode pid_ce 2/99=0
global keepers1987 $keepers1987 pid_ce

ren turnout turnout_
genl turnout=v6a
recode turnout 2=0
global keepers1987 $keepers1987 turnout

genl vote_ce=v8a
recode vote_ce 2/98=0
global keepers1987 $keepers1987 vote_ce


// Campaign Interest

codebook v1
gen intissuenew = v1
recode intissuenew 1=1 2=0 9=.
label variable intissuenew "cared about who won new"
label define care 1 "1=cared"
label values intissuenew care
tab v1 intissuenew
global keepers1987 $keepers1987 intissuenew


// Media Exposure

codebook v2b
gen npfollownew = v2b
recode npfollownew 1=1 2=0 9=.
label variable npfollownew "followed campaign in newspaper new"
label define follows 1 "1=followed"
label values npfollownew follows
tab v2b npfollownew
global keepers1987 $keepers1987 npfollownew

codebook v2d
gen tvfollownew = v2d
recode tvfollownew 1=1 2=0 9=.
label variable tvfollownew "followed campaign on tv new"
label values tvfollownew follows
tab v2d tvfollownew
global keepers1987 $keepers1987 tvfollownew


// Ideology

codebook v29a
gen taxspendnew = v29a
recode taxspendnew 95=1 96=11 98=6 99=. 97=.
replace taxspendnew=(abs(taxspendnew-11))/10
label variable taxspendnew "social spending new"
label define spend 1 "1=pro-spending" 
label values taxspendnew spend
tab taxspendnew
tab v29a
global keepers1987 $keepers1987 taxspendnew

codebook v37a
gen unionregnew = v37a
recode unionregnew 8=3 9=.
replace unionreg=(abs(unionreg-5))/4
label variable unionregnew "gov't regulation of unions new"
label define reg 1 "1=increase regulation"
label values unionregnew reg
tab unionregnew v37a
global keepers1987 $keepers1987 unionregnew

codebook v43o
gen unionregnew1987 = v43o
recode unionregnew1987 8=3 9=.
gen flip = 5-unionregnew1987
replace flip = (abs(flip-4))/4
tab flip
replace unionregnew1987 = flip
drop flip
label variable unionregnew1987 "gov't regulation of unions 1987 new"
label values unionregnew1987 reg
tab unionregnew1987 v43o
global keepers1987 $keepers1987 unionregnew1987

codebook v34a
gen stateownnew = v34a
recode stateownnew 97=. 98=6 99=.
replace stateownnew=(abs(stateownnew-11))/10
label variable stateownnew "nationalisation new"
label define natnlown 1 "1=pro-nationalisation"
label values stateownnew natnlown
tab stateownnew 
tab v34a
global keepers1987 $keepers1987 stateownnew

codebook v36a
gen stateownnew1987 = v36a
recode stateownnew1987 1=1 2=0 3=.5 8=.5 9=. 7=.
label variable stateownnew1987 "nationalisation 1987 new"
label values stateownnew1987 natnlown
tab stateownnew1987 v36a
global keepers1987 $keepers1987 stateownnew1987

codebook v33b
gen povertyspendnew = v33b
recode povertyspendnew 8=3 9=.
replace povertyspendnew = (abs(povertyspendnew-5))/4
label variable povertyspendnew "gov't spending on poverty reduction"
label values povertyspendnew spend
tab v33b povertyspendnew
global keepers1987 $keepers1987 povertyspendnew

codebook v35a
gen redistributenew = v35a
recode redistributenew 97=. 98=6 99=.
replace redistributenew=(abs(redistributenew-11))/10
tab v35a redistributenew
label variable redistributenew "gov't redistribution new"
label define redistrib 1 "1=pro-redistribution new"
label values redistributenew redistrib
tab v35a redistributenew
global keepers1987 $keepers1987 redistributenew

codebook v38b
gen redistributenew1987 = v38b
recode redistributenew1987 8=3 9=.
replace redistributenew1987=(abs(redistributenew1987-5))/4
tab v38b redistributenew1987
label variable redistributenew1987 "gov't redistribution 1987 new"
label values redistributenew1987 redistrib
tab v38b redistributenew1987
global keepers1987 $keepers1987 redistributenew1987

codebook v40a
gen povertyspendnew1987 = v40a
recode povertyspendnew1987 97=. 98=6 99=.
replace povertyspendnew1987 = (abs(povertyspendnew1987-11))/10
tab v40a povertyspendnew1987
label variable povertyspendnew1987 "gov't spending on poverty reduction 1987 new"
label values povertyspendnew1987 spend
tab v40a povertyspendnew1987
global keepers1987 $keepers1987 povertyspendnew1987

codebook v43a
gen welfarespendnew = v43a
recode welfarespendnew 8=3 9=.
gen flip = 6-welfarespend
replace flip = (abs(flip-5))/4
tab v43a flip
replace welfarespend = flip
drop flip
label variable welfarespendnew "welfare spending new"
label values welfarespendnew spend
tab v43a welfarespendnew
global keepers1987 $keepers1987 welfarespendnew

gen taxspendnew1987 = v31
recode taxspendnew1987 1=0 2=.5 3=1 8=.5 9=. 4=.
label variable taxspendnew1987 "social spending 1987 new"
label values taxspendnew1987 spend
tab v31 taxspendnew1987
global keepers1987 $keepers1987 taxspendnew1987

gen taxspendnew19872 = v33f
recode taxspendnew19872 8=3 9=.
gen flip = 6-taxspendnew19872
replace flip = (abs(flip-5))/4
replace taxspendnew19872 = flip
drop flip
tab v33f taxspendnew19872
label variable taxspendnew19872 "social spending 1987 new"
label values taxspendnew19872 spend
tab v33f taxspendnew19872
global keepers1987 $keepers1987 taxspendnew19872

gen unionpowernew1987 = v38c
recode unionpowernew1987 8=3 9=.
gen flip = 6-unionpowernew1987
replace flip = (abs(flip-5))/4
tab flip v38c
replace unionpowernew1987 = flip 
drop flip
label variable unionpowernew1987 "union power 1987 new"
label define powers 1 "1=too much power"
label values unionpowernew1987 powers
tab unionpowernew1987 v38c
global keepers1987 $keepers1987 unionpowernew1987



// Class/occupation

// Assuming that husband is "head of household"
*gen class_head_grade = 
*recode class_head_grade 0=.
label define LblClassGoldHeath 1 "High grade prof./man." 2 "Low grade prof./man." 3 "Routine office" 4 "Sales & personal" 5 "Small petty bourg. w emps" 6 "Small petty bourg. wo emps" 7 "Farmers" 8 "Manual foremen" 9 "Skilled manual" 10 "Semi & unskilled manual" 11 "Agric. employees"
*label values class_head_grade LblClassGrade
*global keepers1987 $keepers1987 class_head_grade

gen class_resp_goldheath = v50a5
recode class_resp_goldheath -1=. 99=.
label values class_resp_goldheath LblClassGoldHeath
global keepers1987 $keepers1987 class_resp_goldheath

gen class_spou_goldheath = v52a5
recode class_spou_goldheath -1=. 99=.
label values class_spou_goldheath LblClassGoldHeath
global keepers1987 $keepers1987 class_spou_goldheath

gen male = v58b
recode male 1=1 2=0
global keepers1987 $keepers1987 male

gen married = v51a
recode married 1=1 2=1 3=0 4=0 5=0 9=0
global keepers1987 $keepers1987 married


gen unionmem_resp = v49c
recode unionmem_resp 1=1 2=1 3=0 9=.
global keepers1987 $keepers1987 unionmem_resp

gen unionmem_spou = v51d
recode unionmem_spou 1=1 2=0 3=0 8=. 9=.
global keepers1987 $keepers1987 unionmem_spou

gen unionmempast_resp = v49d
recode unionmempast_resp 1=1 2=1 3=0 9=.
global keepers1987 $keepers1987 unionmempast_resp

gen unionmempast_spou = v51d
recode unionmempast_spou 1=0 2=1 3=0 8=. 9=.
global keepers1987 $keepers1987 unionmempast_spou



// Economic perceptions

// Not available!
